<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <title>意达设计</title>
    <link rel="stylesheet" type="text/css" href="../css/api.css"/>
    <link rel="stylesheet" type="text/css" href="../css/member.css"/>

</head>
<body class="body">

<!-- header -->
<div class="searchHeader">
	<a href="javascript:void(0);" onclick="api.closeWin();"></a>
	<input type="text" id="key" placeholder="请输入搜索内容">
    <a href="javascript:void(0)" class="searchlink">搜索</a>
</div>

<div class="hr hrBG1"></div>

<!-- contact -->
<div class="prolist">
    <ul id='con'>
        <li>
            <a href="index.html"><img src="../image/index/img-017.jpg"></a>
            <p>莱夫时尚单肩斜跨女包</p>
            <span>HELEN手提女包新品上市，全新上市新品</span>
        </li>
       
    </ul>
</div>
<div class="clearfix" style="margin-bottom: .4rem;"></div>

</body>
<script type="text/javascript" src="../script/api.js"></script>
<script type="text/javascript" src="../script/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="../script/adaptive.js"></script>
<script type="text/javascript" src="../script/tabs.js"></script>
<script type="text/javascript">
    window['adaptive'].desinWidth = 750;
    window['adaptive'].baseFont = 28;
    window['adaptive'].maxWidth = 750;
    window['adaptive'].init();

    

    apiready = function () {
        $api.fixStatusBar($api.dom('.header'));
        api.addEventListener({
            name: 'keyback'
        }, function(ret, err){
            api.closeWidget();
        });
        
        api.showProgress();

        var para=api.pageParam;
        var page=1;

       
        var p= {key:para.key,page:page};

        toDoRequest();

        api. addEventListener({name:'scrolltobottom'}, function(ret, err){
            
            toDoRequest();

        });

        function toDoRequest(){
            
            
            p= {token:token,key:para.key,page:page};
            
                api.ajax({
                    url: webSiteUrl+'/app/user/search',
                    method: 'post',
                    data: {
                        values: p
                    }
                }, function(ret, err) {
                    api.hideProgress();
                    
                    if(ret.code==200){
                        //alert(ret.data.length);return;
                       var tj=ret.data;
                       html = "";
                        for(var i=0;i<tj.length;i++){
                            html+= '<li onclick="detailPlay('+tj[i].id+')"><a href="javascript:void(0);"><img src="'+webSiteUrl+tj[i].icon+'"></a><p>'+tj[i].name+'</p><span>'+tj[i].content+'</span></li>';
                        }
                        if(page==1){
                            $('#con').html(html);
                        }else{
                            $('#con').append(html);
                        }
                        page++;
                        

                    }else{
                        //alert(ret.msg)
                        if(page==1){
                            $('#con').html('<p style="text-align:center">暂无数据</p>');
                        }
                        
                    }
                });
           
        }
        

        
       
          
    };

    $('.searchlink').click(function(){
        var key=$('#key').val();
        if(key==""){
            alert('请输入搜索内容');return;
        }
        var p={type:3,token:token,key:key};
        api.ajax({
            url: webSiteUrl+'/app/user/history',
            method: 'post',
            data: {
                
                values: p
            }
        }, function(ret, err) {
            
            
            if(ret.code==200){
                searchPlay(key);
               

            }else{
                alert(ret.msg)
            }
        });
        
    });

function contains(arr, obj) {  
    var i = arr.length;  
    while (i--) {  
        if (arr[i] === obj) {  
            return true;  
        }  
    }  
    return false;  
} 





</script>

</html>
